package org.teststack.Api.Sl;


import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
import org.teststack.Api.RestClient;

import java.io.UnsupportedEncodingException;

import static org.teststack.Api.CookieManager.cookies;


public class SlQy {

    public static void main(String[] args) throws UnsupportedEncodingException {
        slqy();
    }
    public static int slqy() throws UnsupportedEncodingException {
        // 登录并更新cookies
        RestClient.loginAndUpdateCookies("liutao", "xQ5Vea/L3CMRNEwoBESSZGSVCnValY4kZcAYe3153B9/dXpazZRG8VLEuMhJdW1RhdZ/cqdUq/5FUdAxeKzdWOmZEj0sVlobwrqzRMgrIPsvyp03QTktVYRUAgloA924e5wLLSx8ECJ4WpUAB8zUa41GkyURFmyVtwxQ3EkLuabQ7V24L8EdzRfBHnFd8zRRd4RkncACXO88rrb4U7uR10ANvR0K4N2Kiai901pyztSuMfXP0fVRBW1lKj+kIONtFufTZoAL48++Q6VVr3r5B9tIC4kkwv0WzQxeOubbVKTNUi1JGnS2CEPPqjuXWJnUAO3u5PRxXmtH5+JN8yXygw==");



        String formData = "method=enterFrfw&user_id=&fromSign=&gzkz_check=&bank_check=&secure_check=&tax_check=&gjj_check=&medical_check=&currentTab=&ywlx=&ywzt=&searchcontent=&currentPage=1&qmzt=&searchcontent_qm=&currentPage_wdqm=1&hyzt=&searchcontent_smhy=&currentPage_wdhy=1&sbidCl=&entidCl=&dylxCl=&checkCode=&checkCodeId=6503f9a5a24c454a8b9e05eec1a3f134&messageCode=&csrftoken=";



        // 注意：这里我们仍然将参数放在查询字符串中，尽管这是一个POST请求
        // 如果API设计为接受查询参数，则这是可以的；否则，应考虑将参数放在请求体中
        Response response = RestAssured.given()
                .body(formData)
                .cookies(cookies)
                .baseUri("http://10.1.10.141:9031")
                .post("/unite.do?method=enterQykb"); // 假设这里有一个有效的CSRF Token或它是不必要的

        int statusCode = response.getStatusCode();
//        String body = response.getBody().asString();

        System.out.println("Status Code: " + statusCode);



        return statusCode;


    }
}
